package org.example.lanhang.controller;


import org.example.lanhang.entity.User;
import org.example.lanhang.service.userService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/User")
public class userController {

    @Autowired
    private userService u;

    @GetMapping("/list")
    public String list(Model model) {
        List<User> users = u.findall();
        model.addAttribute("users", users);
        return "User/list";

    }

}
